﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace trunk.Views.SampleViews
{
    /// <summary>
    /// SamplesButton.xaml 的交互逻辑
    /// </summary>
    public partial class SamplesButton : Page
    {
        private int _count = 0;
        public int count { get
            {
                return _count;
            }
            set
            {
                _count = value;
            } }

        public SamplesButton()
        {
            InitializeComponent();
        }

        private void DecreaseButton_Click(object sender, RoutedEventArgs e)
        {
            count--;
            (this.RepeatButtonBtn1 as Button).Content = count.ToString();
        }

        private void IncreaseButton_Click(object sender, RoutedEventArgs e)
        {
            count++;
            (this.RepeatButtonBtn1 as Button).Content = count.ToString();
        }
    }

    public class SampleBtnHeightCalConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length == 3 && values[0] is double parentHeight && values[1] is double control1Height && values[2] is double control2Height)
            {
                // 计算最终高度
                return parentHeight - control1Height - control2Height;
            }
            return 0;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
